<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html; UTF-8" pageEncoding="UTF-8" isELIgnored="false" %><!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学生管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/back/statics/css/bootstrap3.min.css">
    <script src="${pageContext.request.contextPath}/back/statics/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-12">
            <h1 class="text-center">学生信息录入</h1>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-6 col-sm-offset-3">
            <form class="form-horizontal" id="input" action="${pageContext.request.contextPath}/student/save" method="post">
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label">姓名:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="name" name="name" placeholder="请输入学生姓名">
                    </div>
                    <span style="color:red;">*</span>

                </div>

                <div class="form-group">
                    <label for="s_number" class="col-sm-2 control-label">学号:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="s_number" name="s_number" placeholder="请输入学生学号">
                    </div>
                    <span style="color:red;">*</span>
                </div>
                <div class="form-group">
                    <label for="classid" class="col-sm-2 control-label">班级:</label>
                    <div class="col-sm-9">
                        <select name="classid" id="classid" name="classid" class="form-control">
                            <option value="计算数据1871">计算数据1871</option>
                            <option value="计算数据1872">计算数据1872</option>
                        </select>

                    </div>
                    <span style="color:red;">*</span>
                </div>
                <div class="form-group">
                    <label for="age" class="col-sm-2 control-label">年龄:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="age" name="age" placeholder="请输入学生年龄">
                    </div>
                    <span style="color:red;">*</span>
                </div>
                <div class="form-group">
                    <label for="bir" class="col-sm-2 control-label">生日:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="bir" name="bir" placeholder="请输入学生生日,格式为:xx/xx/xx">
                    </div>
                    <span style="color:red;">*</span>
                </div>
                <div class="form-group">
                    <label for="phone" class="col-sm-2 control-label">电话:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="phone" name="phone" placeholder="请输入学生电话">
                    </div>
                    <span style="color:red;">*</span>
                </div>
                <div class="form-group">
                    <label for="qq" class="col-sm-2 control-label">QQ:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="qq" name="qq" placeholder="请输入学生QQ">
                    </div>
                    <span style="color:red;">*</span>
                </div>
                <div class="form-group">
                    <label for="cityid" class="col-sm-2 control-label">城市:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="cityid" name="cityid" placeholder="请输入学生城市">
                    </div>
                    <span style="color:red;">*</span>
                </div>
                <div class="form-group">
                    <label for="tagid" class="col-sm-2 control-label">标签:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="tagid" name="tagid" placeholder="请输入学生标签">
                    </div>
                </div>
                <div class="form-group">
                    <label for="mark" class="col-sm-2 control-label">备注:</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="mark" name="mark" placeholder="请输入学生备注信息">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-10">
                        <button type="submit" class="btn btn-success" style="width: 35%;">确定录入</button>
                        <a href="${pageContext.request.contextPath}/student/findAll" type="submit" class="btn btn-danger" style="width: 35%;">返回列表</a>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>
</body>
</html>
<script>
    $(function (){
        $("#input").submit(function (){
            if (!$("#name").val()){
                alert("学生姓名不能为空");
                return false;
            }
            if (!$("#s_number").val()){
                alert("学生学号不能为空");
                return false;
            }
            if (!$("#age").val()){
                alert("学生学号不能为空");
                return false;
            }
            if (!$("#bir").val()){
                alert("学生生日不能为空");
                return false;
            }
            if (!$("#phone").val()){
                alert("学生电话不能为空");
                return false;
            }
            if (!$("#qq").val()){
                alert("学生qq不能为空");
                return false;
            }
            if (!$("#cityid").val()){
                alert("学生城市不能为空");
                return false;
            }
        });
    })
</script>